using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Pampa.CRUD.Core;
using Pampa.CRUD.Security;


namespace Demo.Utils
{
    public class PersonSecutityManager : ISecurityManager
    {
        public PersonSecutityManager()
        {
        }

        public PermissionType GetPermission(object entity, string action)
        {
            // here I could ask about the role of the logged user 
            // or any state of the entity that it is being edited

            switch (action)
            {
                case "Name":
                    return PermissionType.View;
                case "AdditionalData":
                    return PermissionType.Rejected;
                case "Phones":
                    return PermissionType.Edit;
                default:
                    return PermissionType.NotApply;
            }
        }
    }
}